package com.djk.controller;

import com.djk.service.LovemusicService;
import com.djk.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

@RequestMapping("/loveMusic")
@RestController
public class LoveMusicController {
    @Autowired
    private LovemusicService lovemusicService;

    /**
     * 添加/收藏我喜欢的音乐
     *
     * @return
     */
    @RequestMapping("/addMyLove")
    public Result addMyLove(Integer musicId, HttpSession session) {
        return lovemusicService.addMyLove(musicId, session);
    }

    @RequestMapping("/deleteMyLove")
    public Result deleteMyLove(Integer musicId, HttpSession session) {
        return lovemusicService.deleteMyLove(musicId, session);
    }

    /**
     * 模糊查询
     * @return
     */
    @RequestMapping("/findMyLove")
    public Result findMyLove(@RequestParam(required = false) String musicName,HttpSession session) {
        return lovemusicService.findMyLove(musicName,session);
    }
}
